<?php



namespace App\Http\Requests\ApiV2;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class NoteRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

            'title' => 'required|max:20',
            'description' => 'required',
            'start_point' => 'required',
            'video_id' => 'required',
            'course_id' => 'required',


        ];
    }

    public function messages()
    {
        return [

            'start_point.required' => __('请输入笔记的时间插入点'),
            'video_id.required' => __('请输入笔记的视频id'),
            'course_id.required' => __('请输入笔记的课程id'),
            'title.required' => __('请输入笔记的标题'),
            'title.max' => __('课程标题的长度不能超过:size个字符', ['size' => 20]),
            'description.required' => __('请输入笔记的内容'),


        ];
    }

    public function filldata()
    {
        return [
            'user_id' =>Auth::id(),
            'title' => $this->input('title', ''),
            'start_point'=>$this->input('start_point'),
            'video_id' => $this->input('video_id', 0),
            'course_id' => $this->input('course_id', 0),
            'description' => $this->input('description'),
            'is_show' => (int)$this->input('is_show', 1),


        ];
    }
}
